#!/bin/bash

echo "========================================"
echo "    HLS流媒体服务启动脚本"
echo "========================================"
echo

# 检查FFmpeg是否安装
echo "1. 检查FFmpeg安装状态..."
if ! command -v ffmpeg &> /dev/null; then
    echo "❌ FFmpeg未安装"
    echo "请先安装FFmpeg:"
    echo "  macOS: brew install ffmpeg"
    echo "  Ubuntu: sudo apt install ffmpeg"
    echo "  CentOS: sudo yum install ffmpeg"
    exit 1
else
    echo "✅ FFmpeg已安装"
fi

echo
echo "2. 创建必要的目录..."
mkdir -p static/hls
echo "✅ 目录创建完成"

echo
echo "3. 启动Go服务器..."
echo "服务将在 http://localhost:8080 启动"
echo "演示页面: http://localhost:8080/static/hls_demo.html"
echo
echo "按 Ctrl+C 停止服务"
echo "========================================"
echo

go run main.go